package com.chen.blue.service.test;

import com.chen.blue.annotation.permission.DataPermission;
import com.chen.blue.domain.query.system.DeptQuery;
import com.chen.blue.domain.query.system.MenuQuery;
import com.chen.blue.domain.vo.system.DeptVo;
import com.chen.blue.domain.vo.system.MenuVo;
import com.chen.blue.exception.e.DtoNullException;
import com.chen.blue.result.DataResult;
import com.chen.blue.service.system.IDeptService;
import com.chen.blue.service.system.IMenuService;
import com.chen.blue.service.test.ITestService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created By CLT On 2024/5/12.
 */
@SuppressWarnings("all")
@Service("iTestService")
public class ITestServiceImpl implements ITestService {

    @Resource
    private IMenuService iMenuService;

    @Resource
    private IDeptService iDeptService;

    @DataPermission
    @Override
    public DataResult<Map<String, Object>> testPermission() throws DtoNullException {

        DataResult<Map<String, Object>> result = new DataResult<>();

        DataResult<List<MenuVo>> menuVoDataResult = iMenuService.queryMenu(new MenuQuery(), false);
        List<MenuVo> var1 = menuVoDataResult.getResult();
        DataResult<List<DeptVo>> deptVoDataResult = iDeptService.queryDept(new DeptQuery(), false);
        List<DeptVo> var2 = deptVoDataResult.getResult();
        Map<String, Object> map = new HashMap<>();
        map.put("1", var1);
        map.put("2", var2);

        result.setData(map);

        return result;
    }

}
